package com.runfast.waimai.dao.mapper;

import com.runfast.common.dao.IMapper;
import com.runfast.paotui.dao.model.Order;
import com.runfast.waimai.dao.model.RunfastGoodsSellRecord;
import com.runfast.waimai.dao.model.RunfastGoodsSellRecordExample;
import com.runfast.waimai.util.PageBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface RunfastGoodsSellRecordMapper extends IMapper<RunfastGoodsSellRecord, Integer, RunfastGoodsSellRecordExample> {


    List<RunfastGoodsSellRecord> findByShopperAndSize(@Param("shopperid") Integer shopperid);
    RunfastGoodsSellRecord findByShopperIdAndId(@Param("shopperid") Integer shopperid, @Param("id") Integer id);

    RunfastGoodsSellRecord findByShopperIdAndOrderCode(@Param("shopperid") Integer shopperid, @Param("id") Integer id);

    List<RunfastGoodsSellRecord> findById(Integer shopperid);//骑手ID查找

    RunfastGoodsSellRecord findByOrderCode(String ordercode);

 //   PageBean<RunfastGoodsSellRecord> getPageBean4Driver(@Param("pageSize") Integer pageSize, @Param("page") Integer page, @Param("status") Integer status, @Param("shopperid") Integer shopperId, @Param("agentid") Integer agentid, @Param("teamid") Integer teamid);

    //  pageSize, page,status,shopperId,agentId, teamid
    void update(RunfastGoodsSellRecord record);

    List<RunfastGoodsSellRecord> findBymonth(@Param("shopperid") Integer shopperid, @Param("createTime") Date createtime,@Param("createTime1") Date createTime1);

    List<RunfastGoodsSellRecord> findBytime(@Param("createtime") Date createtime, @Param("enddate") Date enddate, @Param("shopperid") Integer shopperid, @Param("page") int page, @Param("rows") int rows, @Param("agentid") Integer agentid);
    List<RunfastGoodsSellRecord> findListPageBean(@Param("pageSize") Integer pageSize, @Param("page") Integer page, @Param("status") Integer status, @Param("shopperid") Integer shopperid, @Param("agentid") Integer agentid, @Param("teamid") Integer teamid);
    Integer findCount(@Param("pageSize") Integer pageSize, @Param("page") Integer page, @Param("status") Integer status, @Param("shopperId") Integer shopperId, @Param("agentid") Integer agentid, @Param("teamid") Integer teamid);

    RunfastGoodsSellRecord get(Integer id);
    Integer findByShopperIdAndStrutscount(@Param("shopperid") Integer shopperid, @Param("status")Integer status);
    List<RunfastGoodsSellRecord> findByShopperIdAndStruts(@Param("shopperid") Integer shopperid, @Param("status")Integer status,@Param("page")Integer page,@Param("pagesize")Integer pagesize);

    List<RunfastGoodsSellRecord> findByShopperIdAndStrutsAndagree1(@Param("shopperid") Integer shopperid, @Param("status")Integer status);//跑腿异常查询

    List<RunfastGoodsSellRecord> findByShopperIdAndStrutsAndagree2(@Param("shopperid") Integer shopperid, @Param("status")Integer status);//外卖异常查询

    List<Map<String,String>>  findByAgentnameAndbusinessnameAndTime(@Param("agentid") Integer agentid, @Param("name") String name, @Param("date1") Date date1,@Param("date2") Date date2, @Param("isdeliver") Integer isdeliver);

    List<Map<String,String>> findAgentnameMoney(@Param("createtime1") Date createtime1,@Param("createtime2") Date createatime2, @Param("isdeliver") Integer isdeliver);

    List<Map<String,BigDecimal>> findshopperAndCityAndtime(@Param("cityname") String cityname, @Param("shoppername") String shoppername, @Param("ceateatime1") Date ceateatime1, @Param("ceateatime2") Date ceateatime2, @Param("page")Integer page,@Param("pagesize")Integer pagesize);

    int findByShopperIdOrderCodeCount(Integer shopperid);
    int findCountShopperOrder(Integer shopperid);

    int findCountStatus9(Integer shopperid);


    List<RunfastGoodsSellRecord> findaftertime(@Param("createatime1") Date createatime1, @Param("createatime2") Date createatime2, @Param("cityname") String cityname, @Param("shoppername") String shoppername);

    List<RunfastGoodsSellRecord> finderrorOver(@Param("createatime1") Date createatime1, @Param("createatime2") Date createatime2, @Param("cityname") String cityname, @Param("shoppername") String shoppername);
    List<RunfastGoodsSellRecord> findlastscore(@Param("createatime1") Date createatime1, @Param("createatime2") Date createatime2, @Param("cityname") String cityname, @Param("shoppername") String shoppername);

    List<RunfastGoodsSellRecord> findToday(@Param("id") Integer id, @Param("date1") Date date1, @Param("date2") Date date2);

    List<RunfastGoodsSellRecord> findstatus(@Param("status") Integer status,@Param("page")Integer page,@Param("pagesize")Integer pagesize,@Param("agentid") Integer agentid,@Param("shopperId")Integer shopperId,@Param("date")Date date);

    Integer findstatuscount(@Param("status") Integer status,@Param("page")Integer page,@Param("pagesize")Integer pagesize,@Param("agentid") Integer agentid,@Param("shopperid")Integer shopperid,@Param("date")Date date);
    Integer findstatuscount1(@Param("status") Integer status ,@Param("agentid") Integer agentid);
    List<RunfastGoodsSellRecord> findBookTime(@Param("shopperid") Integer shopperid,@Param("bookTime")Date bookTime,@Param("agentid") Integer agentid);
    Integer findBookTimecount(@Param("shopperid") Integer shopperid,@Param("bookTime")Date bookTime,@Param("agentid") Integer agentid);
    RunfastGoodsSellRecord findByOrderCodeid(Integer orderid);

    List<RunfastGoodsSellRecord> findAllAndTime(@Param("id") Integer id,@Param("page") Integer page, @Param("pagesize") Integer pagesize, @Param("time1") Date time1, @Param("time2") Date time2);
   Integer findAllAndTimecount(@Param("id") Integer id,@Param("page") Integer page, @Param("pagesize") Integer pagesize, @Param("time1") Date time1, @Param("time2") Date time2);

    Integer  findNameAndCount(@Param("shopperid") Integer shopperid, @Param("page") Integer page, @Param("pagesize") Integer pagesize, @Param("time1") Date time1, @Param("time2") Date time2,@Param("businessName")String businessName);
    Integer   findstatusnewmsgcount( @Param("page")Integer page, @Param("pageSize")Integer pageSize,@Param("agentid")Integer agentid);

    List<RunfastGoodsSellRecord> findstatusnewmsg(@Param("page")Integer page, @Param("pageSize")Integer pageSize,@Param("agentid")Integer agentid);

    RunfastGoodsSellRecord findByShopperIdAndOrderCode1(@Param("shopperid") Integer shopperid, @Param("orderCode") String orderCode);

    List<Map<String,String>> findcommisson(@Param("shopperid") Integer shopperid,@Param("date1") Date date1,@Param("date2") Date date2);

    Integer findcommissoncount(@Param("shopperid")Integer shopperid, @Param("time1")Date time1, @Param("time2")Date time2);

    List<Map<String,String>> findcommisson8(Integer shopperid);

    List<Map<String,String>> findcommisson7(Integer shopperid);

    RunfastGoodsSellRecord get1(Integer id);

    List<RunfastGoodsSellRecord> findByShopperIdAndStrutsSize(Integer shopperid);

    Integer findShopperAndStatusErroCount(Integer shopperid);
}